<?
        require_once('../inc/Customers.php');
		$row = GetCustomer($_REQUEST['id']);
		$id = $row['id'];
		$contact_results =  GetMethod($id, 'ContactInfo'); 				
		$row_num_contact = $order_results->num_rows;
        if(isset($_POST['sav']))
        {
            $post = $_POST;
            $newrow = CreateContactInfo($post);
            header("Location: index.php");
            die();				
       	}	
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>New User Sign Up</title>
    <link rel="stylesheet" type="text/css" href="../inc/bootstrap.css">
    <style type="text/css" ">
        .error { color: red; }
    </style>
</head>

<body>
        <? include('../inc/header.php'); ?>
        <div class="container">
                        <? include('../inc/nav.php'); ?>
            <div id="contents">             
                <form class="form-horizontal" method="post" action="">
                    <div class=" control-group">
                        <label class="control-label" for="id">Contact Info ID Number:</label>
                        <div class="controls">
                            <input type="text" name="id" id="id" value="" />
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="ContactInfoType">Contact Info Type:</label>
                        <div class="controls">
                            <input type="number" name="ContactInfoType" id="ContactInfoType" value="" min="1" max="2"/>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="Info">Info:</label>
                        <div class="controls">
                            <input type="text" name="Info" id="Info" value="" />
                        </div>
                    </div>
                    <input class="btn btn-primary" type="submit" value="Save" name="sav" />
                </form>
				<table class="table table-striped table-bordered table-condensed table-hover">	 
					 <tr>
						<th>Info ID Number</th>
                        <th>Info Type</th>
                        <th>Info</th>						       			
                    </tr>
					<? while($rs = $contact_results->fetch_assoc()): $type_id = $rs['ContactInfoType_id'];
					$type = GetInfoType($type_id);?>
						
							<tr>					  
								<td><?=$rs['id']?></td>
								<td><?=$type['Type']?></td>						
								<td><?=$rs['Info']?></td>
							</tr>
					<? endwhile; ?>
					<? if ($row_num_contact == 0): $na = "No Registered Contact Infomation."; ?>
							<tr class="error">					  
								<td><?=$na?></td>
								<td></td>
								<td></td>
								<td></td>
								<td></td>
								<td></td>
							</tr>
							
					<? endif ?>	
                </table>

           </div>
       </div>
</body>
</html>